<?php

require './vendor/autoload.php';

use App\Exception\BaseException;
use App\Callback\Product;
use App\Callback\ProcessSale;
use App\Callback\OtherCallable;

$a = function (Product $product) {
    print "a" . "\n";
};

$b = function (Product $product) {
    print "b" . "\n";
};

$processSale = new ProcessSale();

$processSale->registerCallback($a);
$processSale->registerCallback($b);
$processSale->registerCallback([new OtherCallable(), 'func']);


$product1 = new Product('name1', 'price1');
$product2 = new Product('name2', 'price2');

$processSale->sale($product1);
print "\n";
$processSale->sale($product2);
